/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class CheckCompanyNameIsExist extends AbstractAction
/*    */ {
/*    */   public CheckCompanyNameIsExist(AbstractHttpServlet servlet)
/*    */   {
/* 23 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 37 */     User user = super.getLoginUser(request);
/*    */ 
/* 39 */     response.setContentType("text/html;charset=utf-8");
/* 40 */     PrintWriter out = response.getWriter();
/* 41 */     JSONObject jsonObject = new JSONObject();
/*    */ 
/* 43 */     String name = Util.getURLParameter(request.getParameter("companyName"));
/*    */ 
/* 45 */     CustomerManager manager = new CustomerManager();
/*    */     try {
/* 47 */       boolean result = manager.isExistCompanyName(user.companyId, name);
/* 48 */       jsonObject.put("result", result ? "1" : "0");
/*    */     } catch (DBException e) {
/* 50 */       jsonObject.put("result", "0");
/*    */     }
/* 52 */     out.println(jsonObject);
/* 53 */     out.flush();
/* 54 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.CheckCompanyNameIsExist
 * JD-Core Version:    0.6.1
 */